home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 9495 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.8 KB

  1. Path: galaxy.ucr.edu!not-for-mail
  2. From: thp@cs.ucr.edu (Tom Payne)
  3. Newsgroups: comp.lang.ada,comp.lang.c++
  4. Subject: Re: on OO differnces between Ada95 and C++
  5. Followup-To: comp.lang.ada,comp.lang.c++
  6. Date: 2 Mar 1996 01:23:07 GMT
  7. Organization: University of California, Riverside
  8. Message-ID: <4h87tr$eet@galaxy.ucr.edu>
  9. References: <4gbq7q$g08@qualcomm.com> <3129F185.41C6@Rational.COM> <4gi413$qo1@druid.borland.com> <312D8EF7.167E@Rational.COM> <4h08j9$f7v@nntpa.cb.att.com>
  10. NNTP-Posting-Host: corvette.ucr.edu
  11. X-Newsreader: TIN [UNIX 1.3 950824BETA PL0]
  12.  
  13. Kenneth Almquist (ka@socrates.hr.att.com) wrote:
  14. : Jerome Desquilbet <jDesquilbet@Rational.COM> asks:
  15. : > Pete,
  16. : > What is this "one definition rule"? Could you point me to the
  17. : > appropriate C++ Draft Standard location?
  18. : I'm not Pete, but I happen to know the answer.  See section 3.2 in the
  19. : April draft.  The relevant paragraph reads:
  20. :   7 There  can  be  more than one definition of a class type in a program
  21. :     provided that each definition appears in a different translation unit
  22. :     and the definitions describe the same type.
  23.  
  24. So, what exactly does "one definition" mean here?  Is it forms or
  25. occurrences that are being counted?  Or, does the answer vary
  26. depending on whether the definition is of a function or a type?  And,
  27. on whether the multiple occurrences are in the same or different
  28. files?
  29.  
  30. Under the classical independent-compilation model (e.g., g++), I would
  31. expect multiple occurrences of identical definitions to produce errors
  32. if and only if they allocate space (objects and non-inline functions)
  33. or occur in the same translation unit.  It would seem that in, say,
  34. the case of the definition of an inline function, we need an
  35. (identical) occurrence in each translation unit that calls that
  36. function.
  37.  
  38.  
  39. Tom Payne (thp@cs.ucr.edu)
  40.